using System;

namespace OpenFlashChartLib.Charts
{
    public class HBar : Chart<HBarValue>
    {
        public HBar()
        {
            ChartType = "hbar";
        }

        public override void BuildLabels(XAxis xAxis, YAxis yAxis)
        {
            // Don't build X axis labels at all
            yAxis.Labels.Clear();
            foreach (var value in Values)
            {
                yAxis.Labels.Add(value.Label);
            }
            var maxVal = GetMaxValue();
            if (maxVal > 10)
            {
                xAxis.Steps = (int)Math.Ceiling(maxVal/10.0);
            }
        }
    }
}